package com.shijunhao.graduation.controller.system;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shijunhao.graduation.domain.bean.ResultCode;
import com.shijunhao.graduation.domain.dto.SystemLoginLogQueryDto;
import com.shijunhao.graduation.domain.entity.SystemLoginLog;
import com.shijunhao.graduation.domain.entity.SystemOperationLog;
import com.shijunhao.graduation.service.business.ISystemLoginLogService;
import com.shijunhao.graduation.utils.PageUtils;
import com.shijunhao.graduation.utils.WrapperUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shijunhao
 * @since 2022-03-16
 */
@RestController
@RequestMapping("/system-login-log")
@Api(tags = "登录日志")
public class SystemLoginLogController {
    @Resource
    private ISystemLoginLogService systemLoginLogService;


    @GetMapping("list")
    @ApiOperation("列表查询")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public ResultCode<IPage<SystemLoginLog>> page(@ModelAttribute SystemLoginLogQueryDto query){
        Page<SystemLoginLog> page = systemLoginLogService.page(PageUtils.getPage(), WrapperUtils.query(query));
        return ResultCode.success(page);
    }
}
